<template>
  <div>
    <!--引用表格-->
   <BasicTable @register="registerTable" :rowSelection="rowSelection">
     <!--插槽:table标题-->
          <template #tableTitle>
             <a-button  type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
          </template>
    </BasicTable>

  </div>
</template>

<script lang="ts" name="moyan-reportUser" setup>
  import { BasicTable } from '/@/components/Table';
  import {useModal} from '/@/components/Modal';
  import { useListPage } from '/@/hooks/system/useListPage'
  import {columns, searchFormSchema} from './ReportUser.data';
  import {list,getExportUrl} from './ReportUser.api';

  //注册model
  const [registerModal, {openModal}] = useModal();
  //注册table数据
  const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
       tableProps:{
         rowKey:'createTime',
         title: '渠道增长分析',
         api: list,
         columns,
         canResize:false,
         formConfig: {
           labelWidth: 120,
           schemas: searchFormSchema,
           fieldMapToTime: [['fieldTime', ['joinedDate_begin', 'joinedDate_end'], 'YYYY-MM-DD']],
           autoSubmitOnEnter:true,
           showAdvancedButton:true,
         },
         showActionColumn: false,
         beforeFetch: (params)=>{
            return Object.assign({ column: 'joinedDate', order: 'asc' },params)
         }
        },
        exportConfig: {
         name:"渠道增长分析",
         url: getExportUrl,
        },

   })

   const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext

</script>
<style scoped>

</style>
